// import store from '/store/index.js' //vuex  
let server_url = 'http://8.130.32.118:8080' //请求地址
// let token = ' '; 凭证
process.env.NODE_ENV === 'development' ? server_url : 'http://***/api' //环境配置
function service(options = {}) {
	options.url = `${server_url}${options.url}`

	return new Promise((resolved, rejected) => {
		//成功
		options.success = res => {
		
			resolved(JSON.parse(res.data))
		}
		//错误
		options.fail = err => {
			uni.hideLoading()
			uni.showToast({
				icon: 'none',
				duration: 3000,
				title: '请求错误'
			})
			rejected(err) //错误
		}
		uni.uploadFile(options)

	})
}
export default service
